package com.group.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.group.pojo.TbContract;
import com.group.pojo.TbCustomer;
import com.group.service.ContractService;

@Controller
@RequestMapping("/contract")
public class ContractController {
	@Autowired
	private ContractService contractService;
	 
	//可供报修的设备
	@RequestMapping("queryLoginCustomer.action")
	@ResponseBody
	public List<TbContract> queryLoginCustomer(HttpServletRequest request) {
		TbCustomer cus = (TbCustomer) request.getSession().getAttribute("CUSTOMER_SESSION");
		TbContract contract = new TbContract();
		contract.setCustomerId(cus.getId());
		contract.setContractStatus("1");
		List<TbContract> list = contractService.query(contract);
		return list;
	}
	
	@RequestMapping("query.action")
	@ResponseBody
	public List<TbContract> query(TbContract contract) {
		List<TbContract> list = contractService.query(contract);
		return list;
	}
}
